Welcome Guest, you are in: Login
CTS Futures

Page History: Flatten Order

Compare Page Revisions



« Older Revision - Back to Page History - Current Revision


Page Revision: 2014/08/28 14:42


A Flatten order can be used to flatten a current position regardless of what that position is. The T4 FIX API server figures out the volume and Buy/Sell parameters. If a position does not currently exist for the SecurityID (Tag 48) of the submitted flatten order, the order is rejected.

A Flatten Order is entered with the New Order Single (Tag 35=D) message. Following are the most relevant tags to build a Flatten order.

Tag 40=FOrdTypeSpecifier of Flatten Order Type
Tag 38OrderQtySet to 0 to have the T4 FIX API server determine the volume needed to flatten the position. A finite quantity may also be entered.
Tag 54SideSet to 0 (NONE) to have the T4 FIX API server determine whether it should be buying or selling to flatten the position. A finite quantity may also be entered.
Tag 48SecurityIDMarket for which the order is sent
Tag 55SymbolContract for which the order is sent
Tag 200SecurityExchangeExchange for which the order is sent
Tag 167SecurityTypeSecurity Type (e.g. Futures) of this specific market

OrderQty Considerations

Specifying the OrderQty (Tag 38) to 0 also allows the API server to bypass certain risk management checks. For example, if you have a Max Clip Size of 10 but a Max Position of 20 and are currently 15 long, the server can submit a 15-lot sell without being rejected due to exceeding the Max Clip Size of 10.

If a non-zero OrderQty (Tag 38) is specified, this order quantity acts as the maximum volume the server will submit. In the prior example, if an order quantity of 12 is specified then only a 12-lot order would be submitted (instead of a 15-lot order). For example, if at the time of submitting a flatten order, a long position of 15 is held, then an OrderQty of 15 can be specified so that only that 15 (or less) would get flattened (in the event that more fills came in while submitting the order). Note the specification of OrderQty leads to a check against risk management. The order may be rejected if it does not pass risk assessment (e.g. exceeds Max Clip size).

Side Considerations

An Undefined Side (Tag 54=0) allows the T4 FIX API server determine the side to flatten the position. If a Side of BUY (Tag54=1) or SELL (Tag54=2) is specifid, the T4 FIX API server will only flatten if the position is in the correct direction. Fpr instance, if a long position is held, sending a flatten order with a Side of BUY (Tag 54=1) will result in the T4 FIX API server rejecting the order.

Sample

In this example, the Flatten order is submitted for by entering OrderType (Tag 40) equal to F. Note that the Price (Tag 44) is not entered, Side (Tag 54) is set to 0 (NONE) and OrderQty (Tag 38) is set to 0.

Flatten Order
>> 2/22/2013 12:51:28 PM   [FIXNEWORDER] 34=153|49=T4Example|56=T4|50=TraderName|52=20130222-18:51:28.207|1=Account1|11=fn-634971342882072305|48=CME_20130300_ZCH3|55=ZC|207=CME_C|54=0|38=0|40=F|59=0|167=FUT|21=1|60=20130222-18:51:28.207|204=0|
[FIXNEWORDER]
[MsgSeqNum] 34 = 153
[SenderCompID] 49 = T4Example
[TargetCompID] 56 = T4
[SenderSubID] 50 = TraderName
[SendingTime] 52 = 20130222-18:51:28.207
[Account] 1 = Account1
[ClOrdID] 11 = fn-634971342882072305
[SecurityID] 48 = CME_20130300_ZCH3
[Symbol] 55 = ZC
[SecurityExchange] 207 = CME_C
[Side] 54 = 0 (NONE)
[OrderQty] 38 = 0
[OrdType] 40 = F (FLATTEN)
[TimeInForce] 59 = 0 (DAY)
[SecurityType] 167 = FUT (FUTURE)
[HandlInst] 21 = 1 (AUTOMATED_EXECUTION_ORDER_PRIVATE_NO_BROKER_INTERVENTION)
[TransactTime] 60 = 20130222-18:51:28.207
[CustomerOrFirm] 204 = 0 (CUSTOMER)

Flatten Order Response - Awaiting Trigger
<< 2/22/2013 12:51:28 PM  [fixexecutionreport] 34=536|49=T4|56=T4Example|50=T4FIX|52=20130222-18:51:28.207|143=UK|1=Account1|11=fn-634971342882072305|17=0.634971342895618750.2.1.DF0E0564|150=A|37=DF0E0564-9063-4C02-8F21-071C4DE1C419|39=A|48=CME_20130300_ZCH3|55=ZC|207=CME_C|200=201303|59=0|107=Corn Mar13|54=0|167=FUT|38=0|40=F|58=Flatten Awaiting Trigger|60=20130222-18:51:29.561|21=1|204=0|
[FIXEXECUTIONREPORT]
[MsgSeqNum] 34 = 536
[SenderCompID] 49 = T4
[TargetCompID] 56 = T4Example
[SenderSubID] 50 = T4FIX
[SendingTime] 52 = 20130222-18:51:28.207
[TargetLocationID] 143 = UK
[Account] 1 = Account1
[ClOrdID] 11 = fn-634971342882072305
[ExecID] 17 = 0.634971342895618750.2.1.DF0E0564
[ExecType] 150 = A (PENDING_NEW)
[OrderID] 37 = DF0E0564-9063-4C02-8F21-071C4DE1C419
[OrdStatus] 39 = A (PENDING_NEW)
[SecurityID] 48 = CME_20130300_ZCH3
[Symbol] 55 = ZC
[SecurityExchange] 207 = CME_C
[MaturityMonthYear] 200 = 201303
[TimeInForce] 59 = 0 (DAY)
[SecurityDesc] 107 = Corn Mar13
[Side] 54 = 0 (NONE)
[SecurityType] 167 = FUT (FUTURE)
[OrderQty] 38 = 0
[OrdType] 40 = F (FLATTEN)
[Text] 58 = Flatten Awaiting Trigger
[TransactTime] 60 = 20130222-18:51:29.561
[HandlInst] 21 = 1 (AUTOMATED_EXECUTION_ORDER_PRIVATE_NO_BROKER_INTERVENTION)
[CustomerOrFirm] 204 = 0 (CUSTOMER)

Flatten Order Response
<< 2/22/2013 12:51:28 PM  [fixexecutionreport] 34=537|49=T4|56=T4Example|50=T4FIX|52=20130222-18:51:28.254|143=UK|1=Account1|11=fn-634971342882072305|17=48085.7016210353_ZCH3.6349713428968100006.1.DF0E0564|150=0|37=DF0E0564-9063-4C02-8F21-071C4DE1C419|39=0|48=CME_20130300_ZCH3|55=ZC|207=CME_C|200=201303|59=0|107=Corn Mar13|54=2|167=FUT|38=1|40=1|60=20130222-18:51:29.681|21=1|204=0|
[FIXEXECUTIONREPORT]
[MsgSeqNum] 34 = 537
[SenderCompID] 49 = T4
[TargetCompID] 56 = T4Example
[SenderSubID] 50 = T4FIX
[SendingTime] 52 = 20130222-18:51:28.254
[TargetLocationID] 143 = UK
[Account] 1 = Account1
[ClOrdID] 11 = fn-634971342882072305
[ExecID] 17 = 48085.7016210353_ZCH3.6349713428968100006.1.DF0E0564
[ExecType] 150 = 0 (NEW)
[OrderID] 37 = DF0E0564-9063-4C02-8F21-071C4DE1C419
[OrdStatus] 39 = 0 (NEW)
[SecurityID] 48 = CME_20130300_ZCH3
[Symbol] 55 = ZC
[SecurityExchange] 207 = CME_C
[MaturityMonthYear] 200 = 201303
[TimeInForce] 59 = 0 (DAY)
[SecurityDesc] 107 = Corn Mar13
[Side] 54 = 2 (SELL)
[SecurityType] 167 = FUT (FUTURE)
[OrderQty] 38 = 1
[OrdType] 40 = 1 (MARKET)
[TransactTime] 60 = 20130222-18:51:29.681
[HandlInst] 21 = 1 (AUTOMATED_EXECUTION_ORDER_PRIVATE_NO_BROKER_INTERVENTION)
[CustomerOrFirm] 204 = 0 (CUSTOMER)

Flatten Order Fill
<< 2/22/2013 12:51:28 PM  [fixexecutionreport] 34=538|49=T4|56=T4Example|50=T4FIX|52=20130222-18:51:28.472|143=UK|1=Account1|11=fn-634971342882072305|17=70184:6787286TN0120234.63497134289681000021.2.DF0E0564|150=F|37=DF0E0564-9063-4C02-8F21-071C4DE1C419|39=2|48=CME_20130300_ZCH3|55=ZC|207=CME_C|200=201303|59=0|107=Corn Mar13|54=2|167=FUT|38=1|40=1|31=69475|32=1|14=1|151=0|60=20130222-18:51:29.827|21=1|204=0|337=TRADE|375=CME000A|
[FIXEXECUTIONREPORT]
[MsgSeqNum] 34 = 538
[SenderCompID] 49 = T4
[TargetCompID] 56 = T4Example
[SenderSubID] 50 = T4FIX
[SendingTime] 52 = 20130222-18:51:28.472
[TargetLocationID] 143 = UK
[Account] 1 = Account1
[ClOrdID] 11 = fn-634971342882072305
[ExecID] 17 = 70184:6787286TN0120234.63497134289681000021.2.DF0E0564
[ExecType] 150 = F
[OrderID] 37 = DF0E0564-9063-4C02-8F21-071C4DE1C419
[OrdStatus] 39 = 2 (FILLED)
[SecurityID] 48 = CME_20130300_ZCH3
[Symbol] 55 = ZC
[SecurityExchange] 207 = CME_C
[MaturityMonthYear] 200 = 201303
[TimeInForce] 59 = 0 (DAY)
[SecurityDesc] 107 = Corn Mar13
[Side] 54 = 2 (SELL)
[SecurityType] 167 = FUT (FUTURE)
[OrderQty] 38 = 1
[OrdType] 40 = 1 (MARKET)
[LastPx] 31 = 69475
[LastShares] 32 = 1
[CumQty] 14 = 1
[LeavesQty] 151 = 0
[TransactTime] 60 = 20130222-18:51:29.827
[HandlInst] 21 = 1 (AUTOMATED_EXECUTION_ORDER_PRIVATE_NO_BROKER_INTERVENTION)
[CustomerOrFirm] 204 = 0 (CUSTOMER)
[ContraTrader] 337 = TRADE
[ContraBroker] 375 = CME000A

Further details on the tags used for this order type are described in the dictionary of the New Order Single message.

Trade how you want, where you want

support@ctsfutures.com (312) 939 0164

2 Pierce Pl, Suite 200, Itasca, IL 60143

© 2009-2023 Cunningham Trading Systems LLC All rights reserved.